
parent_list = [

    {
        "id": 7,
        "content": "第3条一级评论",
        "user__nickname": "小明-2",
        "user__avatar": "https://zj-1323324849.cos.ap-nanjing.myqcloud.com/2x.jpg",
        "create_date": "2024-01-10T08:17:38.809368Z"
    },
    {
        "id": 6,
        "content": "第2条一级评论",
        "user__nickname": "小明-1",
        "user__avatar": "https://zj-1323324849.cos.ap-nanjing.myqcloud.com/2x.jpg",
        "create_date": "2024-01-10T08:17:38.801451Z"
    },
    {
        "id": 1,
        "content": "第1条一级评论",
        "user__nickname": "郑健",
        "user__avatar": "aads",
        "create_date": "2024-01-10T08:17:38.756649Z"
    }
]




node_list =[
    {
        "id": 3,
        "content": "第一条的二级评论的第二条",
        "user__nickname": "小明-6",
        "user__avatar": "https://zj-1323324849.cos.ap-nanjing.myqcloud.com/2x.jpg",
        "create_date": "2024-01-10T08:17:38.774205Z",
        "reply_id": 1,
        "reply__user__nickname": "郑健"
    },
    {
        "id": 8,
        "content": "第二条一级评论下的第一条二级评论",
        "user__nickname": "小明-2",
        "user__avatar": "https://zj-1323324849.cos.ap-nanjing.myqcloud.com/2x.jpg",
        "create_date": "2024-01-10T08:17:38.809368Z",
        "reply_id": 6,
        "reply__user__nickname": "小明-1"
    }
]

parent_dict = {}
for item in parent_list:
    parent_dict[item['id']] = item

for item in node_list:
    parent_dict[item['reply_id']]['child'] = [item,]

print(parent_dict)
